<?php require 'head.php' ?>
<?php

// 处理成功，显示的message
if (isset($_GET['done'])) {
  if($_GET['done'] == 'add'){
      $message = '添加分类成功!';
  } else if($_GET['done'] == 'upd'){
      $message = '修改分类成功!';
  } else if($_GET['done'] == 'del'){
      $message = '删除分类成功!';
  } else {
      $message = '操作成功!';
  }

}
?>
<?php if (isset($message)) { ?>
<div class="updated"><?php echo $message; ?></div>
<?php } ?>
<div class="admin_page_name">分类管理<a class="link_button" href="cateEdit.php">添加分类</a></div>
<div class="table_list post_list">
<table colspan="0" rowspan="0" cellpadding="0" cellspacing="0" id="list">
  <thead>
    <tr>
        <td>NO.</td>
        <td>名称(中文)</td>
        <td>别名(英文)</td>
        <td>类别</td>
        <td>显示位置</td>
        <td>排序</td>
        <td>编辑</td>
    </tr>
  </thead>
  <tbody>
      <?php 
        $num = 0;
        foreach($kw_categories as $key => $val){
            $num++;
      ?>
        <tr<?php if ($num % 2 == 0) echo ' class="alt"'; ?>>
            <td><?php echo $num; ?></td>
            <td><?php echo htmlspecialchars($val['name']); ?></td>
            <td><?php echo htmlspecialchars($key); ?></td>
            <td>
                <?php
                  if(intval($val['class']) == 0){
                      echo '单页';
                  } else if(intval($val['class']) == 1){
                      echo '文本列表';
                  } else if(intval($val['class']) == 2){
                      echo '图片列表';
                  }
                ?>
            </td>
            <td>
                <?php
                  if(intval($val['show']) == 1){
                      echo '导航栏';
                  } else if(intval($val['show']) == 2){
                      echo '侧边栏';
                  } else if(intval($val['show']) == 3){
                      echo '导航栏和侧边栏';
                  }
                ?>
            </td>
            <td><?php echo $val['order']; ?></td>
            <td>
                <a class="link_button" href="cateEdit.php?key=<?php echo htmlspecialchars($key); ?>">修改</a>
                <a class="link_button" href="#">查看</a>
                <a class="link_button" onclick="return window.confirm('单击“确定”继续。单击“取消”停止。');" href="cateEdit.php?act=del&key=<?php echo htmlspecialchars($key); ?>">删除</a>
            </td>
        </tr>
      <?php
        }
      ?>
  </tbody>
  <tfoot>
    <tr>
        <td>NO.</td>
        <td>名称(中文)</td>
        <td>别名(英文)</td>
        <td>类别</td>
        <td>显示位置</td>
        <td>排序</td>
        <td>编辑</td>
    </tr>
  </tfoot>
</table>
</div>
<?php require 'foot.php' ?>